//
//  NSURLSessionConfiguration+ZHAPMExchangeMethod.m
//  ZYT_IOS
//
//  Created by 正合适 on 2018/1/24.
//  Copyright © 2018年 正合适. All rights reserved.
//

#import "NSURLSessionConfiguration+ZHAPMExchangeMethod.h"
#import <objc/runtime.h>
@implementation NSURLSessionConfiguration (ZHAPMExchangeMethod)

+ (void)load {
//    Method method1 = class_getClassMethod(NSClassFromString(@"NSURLSessionConfiguration"), @selector(defaultSessionConfiguration));
//    Method method2 = class_getClassMethod(self.class, @selector(ZHAPM_defaultSessionConfiguration));
//    Method method3 = class_getClassMethod(NSClassFromString(@"NSURLSessionConfiguration"), @selector(ephemeralSessionConfiguration));
//
//    method_exchangeImplementations(method1, method2);
//    method_exchangeImplementations(method3, method2);
//
//    Method method4 = class_getClassMethod(NSClassFromString(@"NSURLSessionConfiguration"), @selector(backgroundSessionConfigurationWithIdentifier:));
//    Method method5 = class_getClassMethod(self.class, @selector(ZHAPM_backgroundConfigration:));
//    method_exchangeImplementations(method4, method5);

}

+ (NSURLSessionConfiguration *)ZHAPM_defaultSessionConfiguration {
    NSURLSessionConfiguration *con = [NSURLSessionConfiguration ZHAPM_defaultSessionConfiguration];
    con.protocolClasses = @[[NSClassFromString(@"ZHAPMUrlProtocol") class]];
    return con;
}

+ (NSURLSessionConfiguration *)ZHAPM_backgroundConfigration:(NSString *)identifier {
    NSURLSessionConfiguration *con = [NSURLSessionConfiguration ZHAPM_backgroundConfigration:identifier];
    con.protocolClasses = @[[NSClassFromString(@"ZHAPMUrlProtocol") class]];
    return con;
}



@end
